package com.test.rest.client;

import java.io.IOException;

import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

public class Client2 {

	public static void main(String[] args) throws Exception {
		
		HttpGet get = new HttpGet("http://localhost:9000/customerservice/customers/123");
		
//		get.addHeader("Accept", "application/xml");
		get.addHeader("Accept", "application/json");
		
		HttpClient client = new DefaultHttpClient();
		
		try {

			HttpResponse response = client.execute(get);

			System.out.println("code : " + response.getStatusLine().getStatusCode());
			System.out.println(EntityUtils.toString(response.getEntity()));
		} finally {
			get.releaseConnection();
		}
		
		
	}
	
}
